package munci.core.words;

import munci.core.Stack;
import munci.core.Word;
import munci.core.WordImpl;
import munci.core.Dictionary.Name;

public class Types {
	
	@Name("type") public static final Word.R1<Class<?>, Stack> TYPE =
		new WordImpl.R1<Class<?>, Stack>() {
			public Class<?> call(Stack stack) {
				StringBuilder str = new StringBuilder();
				String sep = "";
				while (stack.depth() > 0) {
					str.append(sep).append(stack.popUnder());
					sep = ".";
				}
				try {
					return Class.forName(str.toString());
				} catch (ClassNotFoundException e) {
					throw new RuntimeException(e);
				}
			}};
}
